@namespace SwashbucklerDiary.Rcl.Components
@inherits CardListComponentBase<TagModel>

<div class="card-list__wrap">
    <div class="card-list__main">
        <CascadingValue Value="options"
                        IsFixed="true">
            <Virtualize Items="InternalValue"
                        ItemSize="60"
                        Context="item">
                <TagCard @key="item.Id"
                         Value="item"
                         OnMenu="OpenMenu"
                         OnCalcDiaryCount="CalcDiaryCount">
                </TagCard>
            </Virtualize>
        </CascadingValue>
    </div>
    @if (ShowStatisticsCard)
    {
        <MultiDisplay MdAndUp="true">
            <DesktopContent>
                <div class="card-list__assist-info">
                    <TagStatisticsCard Value="Value"
                                       Diaries="Diaries">
                    </TagStatisticsCard>
                </div>
            </DesktopContent>
        </MultiDisplay>
    }
</div>

<EmptyResult Show="Value.Count == 0"
             Text="@(I18n.T("No tag"))">
</EmptyResult>

<InputDialog @bind-Visible="showRename"
             Text="@(SelectedItem.Name)"
             Title="@(I18n.T("Rename tag"))"
             Placeholder="@(I18n.T("Please enter a tag name"))"
             OnOK="ConfirmRename">
</InputDialog>

<DeleteDialog @bind-Visible="showDelete"
              Title="@(I18n.T("Delete tag"))"
              Content="@(I18n.T("Just deleting the tag does not delete the diary under the tag"))"
              OnOK="ConfirmDelete">
</DeleteDialog>

<ExportDialog @bind-Visible="showExport"
              Value="exportDiaries">
</ExportDialog>

<RadioDialog @bind-Value="SortItem"
             @bind-Visible="showSort"
             OnChange="SortChanged"
             TItem="string"
             TItemValue="string"
             Title="@(I18n.T("Sort"))"
             Row="true"
             Items="SortItems"
             ItemText="it => I18n.TForOrder(it)">
</RadioDialog>

<MultiMenu @bind-Visible="showMenu"
           DynamicListItems="menuItems"
           ActivatorAttributes="menuActivatorAttributes">
</MultiMenu>
